home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
HELP_MAN
/
HELP_EXA.C
next >
Wrap
C/C++ Source or Header
|
1990-04-18
|
1KB
|
76 lines
/* this is a quick and dirty example of how to use my help manager
*
* It puts up a dialog that has a few topics for help
*
* I have the include MacHeaders option set
*/
#include "utilities.h"
#include "help.h"
#define HELP_DLOG 128
#define TOPIC_ITEM 3
#define DATA_ITEM 4
#define TOPIC_TYPE *(long*)"STR#"
#define DATA_TYPE *(long*)"DATA"
#define TOPIC_ID 128
#define DATA_ID 128
#define THE_FONT geneva
#define THE_SIZE 12
static void DoIt(void);
void main(void)
{
InitToolbox();
DoIt();
} /*main*/
static void DoIt(void)
{
DialogPtr theDialog = GetNewDialog(HELP_DLOG,(void*)0,(void*)-1);
GrafPtr TempPtr;
HelpHandle help;
Rect topicRect, dataRect;
short itemHit = 0;
CenterWindow(theDialog);
ShowWindow(theDialog);
GetPort(&TempPtr);
SetPort(theDialog);
TextFont(THE_FONT);
TextSize(THE_SIZE);
topicRect = GetDItemBox(theDialog,TOPIC_ITEM);
dataRect = GetDItemBox(theDialog,DATA_ITEM);
help = HelpNew(theDialog,topicRect,dataRect,TOPIC_TYPE,TOPIC_ID,DATA_TYPE,DATA_ID);
FrameRect(&topicRect);
FrameRect(&dataRect);
while (itemHit != OK && itemHit != Cancel) {
ModalDialog(GenericFilter,&itemHit);
if (itemHit == TOPIC_ITEM || itemHit == DATA_ITEM) {
Point where;
GetMouse(&where);
HelpClick(help,where);
}
}
SetPort(TempPtr);
HelpDispose(help);
DisposDialog(theDialog);
} /*DoIt*/